/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-03-20
 * Time: 22:46
 */
class Student {
    public String name;
    public int age;
    //实例代码块
    {
        this.name = "liming";
        this.age = 18;
        System.out.println("父类实例代码块!");
    }

    // 静态代码块
    static {
        System.out.println("父类静态代码块!");
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("父类构造方法!");
    }
}
class Classmate extends Student {
    {
        System.out.println("子类实例代码块");
    }
    static {
        System.out.println("子类静态代码块");
    }

    public Classmate(String name, int age) {
        super(name, age);
        System.out.println("子类构造方法");
    }
}

